package com.it.taobao.controller;

import com.it.taobao.service.TaoBaoService;
import com.it.taobao.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author: liminghui
 * @date: 2022/6/26 17:34
 * @version: 1.0
 * @description:
 */
@Controller
public class TaoBaoController {
    @Autowired
    private TaoBaoService taoBaoService;

    //数据库双11 所有买家消费行为比例
    @RequestMapping("/action")
    @ResponseBody
    public List<Action> action() {
        List<Action> actionList = taoBaoService.action();
        return actionList;
    }

    //男女买家交易对比
    @RequestMapping("/gender")
    @ResponseBody
    public List<Gender> gender() {
        List<Gender> genderList = taoBaoService.gender();
        return genderList;
    }

    //男女买家各个年龄段交易对比
    @RequestMapping("/ageRange")
    @ResponseBody
    public List<AgeRange> ageRange() {
        List<AgeRange> ageRanges = taoBaoService.ageRange();
        return ageRanges;
    }

    //获取销量前五的商品类别
    @RequestMapping("/catalogTop5")
    @ResponseBody
    public List<CatalogTop5> catalogTop5() {
        List<CatalogTop5> catalogTop5s = taoBaoService.catalogTop5();
        return catalogTop5s;
    }

    // @CrossOrigin(origins = "*", maxAge = 3600)
    //各个省份的总成交量对比
    @RequestMapping("/province")
    @ResponseBody
    public List<Province> province() {
        List<Province> provinces = taoBaoService.province();
        return provinces;
    }
}
